const FilmReducer = (preState = { filmList: [] }, action = {}) => {
  const state = { ...preState };
  const { type, payload } = action;
  switch (type) {
    case 'change-filmList':
      state.filmList = [...payload];
      return state;
    case 'clear-filmList':
      state.filmList = [];
      return state;
    default:
      return preState;
  }
};

export default FilmReducer;
